// Compare two string to see if they are less,greator or equal
// Version 1.0
// Date 16:02 08/10/2016
// By Ben a.k.a DreamVB

#include <iostream>

using namespace std;
using std::cout;
using std::endl;

int StrCompare2(string s0, string s1){
	int flag = 0;
	bool IsGood = true;
	int i = 0;

	//Check if the twi strings match
	if (s0.length() == s1.length()){
		//Compare each char
		while (i < s0.length()){
			if (s0[i] != s1[i]){
				IsGood = false;
				break;
			}
			i++;
		}
	}
	else{
		return 2;
	}

	//If string match just return
	if (IsGood){
		return 0;
	}
	i = 0;
	//Check both strings how less or more
	while (i<s0.length()){
		if (s0[i] < s1[i]){
			flag = -1;
			break;
		}
		if (s0[i]>s1[i]){
			flag = 1;
			break;
		}
		i++;
	}

	return flag;
}

int main(int argc, char *argv[]){
	string s0 = "Hello";
	string s1 = "Hello";

	int t = StrCompare2(s0, s1);

	cout << "s0 " << s0.c_str() << endl;
	cout << "s1 " << s1.c_str() << endl;

	switch (t){
	case -1:
		cout << "s0 is less than s1" << endl;
		break;
	case 0:
		cout << "s1 and s1 are the same" << endl;
		break;
	case 1:
		cout << "s0 is greator than s1" << endl;
		break;
	case 2:
		cout << "s0 and s1 do not equal" << endl;
		break;
	}

	system("pause");
	return 0;
}